/****************************************************************************
 *
 *  XDATA.H
 *
 *  (C) Copyright 1997 by Autodesk, Inc.
 *
 *  This program is copyrighted by Autodesk, Inc. and is licensed to you under
 *  the following conditions.  You may not distribute or publish the source
 *  code of this program in any form.  You may incorporate this code in object
 *  form in derivative works provided such derivative works are (i.) are de-
 *  signed and intended to work solely with Autodesk, Inc. products, and (ii.)
 *  contain Autodesk's copyright notice "(C) Copyright 1995 by Autodesk, Inc."
 *
 *  AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  AUTODESK SPE-
 *  CIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
 *  A PARTICULAR USE.  AUTODESK, INC.  DOES NOT WARRANT THAT THE OPERATION OF
 *  THE PROGRAM WILL BE UNINTERRUPTED OR ERROR FREE.
 *
 ***************************************************************************/

#ifndef XDATA_H
#define XDATA_H

#include "3DSTYPE.H"
#include "DBASE3DS.H"

/* Public Typedefs */
typedef struct {
   long3ds size;
   void3ds *data;
} xdataraw3ds;

/* End Public */

typedef enum
{
   XDataEntry3ds = 0x8001,
   XDataAppName3ds = 0x8002,
   XDataString3ds = 0x8003,
   XDataFloat3ds = 0x8004,
   XDataDouble3ds = 0x8005, 
   XDataShort3ds = 0x8006,
   XDataLong3ds = 0x8007, 
   XDataVoid3ds = 0x8008,
   XDataGroup3ds = 0x8009
   
} xdatatag3ds;

typedef struct xdata3ds
{
   xdatatag3ds xtag;
   union {
      struct { /* Used when the entry contains recognizable sub chunks */
         long3ds items;
         struct xdata3ds *list;
      } entry;
      char3ds *name; /* Appname field */
      char3ds *string; /* XDATA_STRING chunk */
      float3ds f; /* XDATA_FLOAT chunk */
      double3ds d; /* XDATA_DOUBLE chunk */
      short3ds s; /* XDATA_SHORT chunk */
      long3ds l;  /* XDATA_LONG chunk */
      struct { /* XDATA_VOID chunk */
         long3ds size;
         void3ds *v;
      } v;
      struct { /* XDATA_GROUP chunk */
         long3ds items;
         struct xdata3ds *list;
      } group;
      struct { /* XDATA_ENTRY with no recognizable sub chunks */
         long3ds size;
         void3ds *data;
      } rawentry;
   } data;
} xdata3ds;

/* Public Prototypes */
void GetMeshXDataByName3ds(database3ds *db, char3ds *meshname, char3ds *appname, xdataraw3ds **data);
ulong3ds GetMeshXDataCount3ds(database3ds *db, char3ds *meshname);
/* End Public */
ulong3ds GetXDataCount3ds(chunk3ds *chunk);
void GetXDataNameList3ds(chunk3ds *chunk, namelist3ds **list);
void FindXDataEntryByName3ds(chunk3ds *chunk, char3ds *appname, chunk3ds **xentry);
void AddXData3ds(chunk3ds *chunk, xdata3ds *data);
void AddXDataEntry3ds(chunk3ds *chunk, char3ds *appname, xdata3ds *data);
void AddAmbientLightNodeXData3ds(database3ds *db, char3ds *appname, xdata3ds *data);
void AddCameraNodeXData3ds(database3ds *db, char3ds *camname, char3ds *appname, xdata3ds *data);
void PutCameraXData3ds(database3ds *db, char3ds *camname, char3ds *appname, xdata3ds *data);
void PutMaterialXData3ds(database3ds *db, char3ds *matname, char3ds *appname, xdata3ds *data);
void PutMeshXData3ds(database3ds *db, char3ds *meshname, char3ds *appname, xdata3ds *data);
void AddObjectNodeXData3ds(database3ds *db, char3ds *name, char3ds *appname, xdata3ds *data);
void AddOmnilightNodeXData3ds(database3ds *db, char3ds *name, char3ds *appname, xdata3ds *data);
void AddSpotlightNodeXData3ds(database3ds *db, char3ds *name, char3ds *appname, xdata3ds *data);
void AddKfSectionXData3ds(database3ds *db, char3ds *appname, xdata3ds *data);
void PutMeshSectionXData3ds(database3ds *db, char3ds *appname, xdata3ds *data);



#endif
